<template>
  <div>
    <button @click="invokeHtmlMethod">vue方法调用html种方法</button>
    <div>
      <iframe name="iframeMap" ref="iframeMap" id="iframeMapViewComponent" src="../../../static/test.html" width="100%" height="200px" frameborder="10px" scrolling="no"></iframe>
      <iframe name="iframeMap" ref="iframeMap" id="iframeMapViewComponent" src="../../../public/index.html" width="100%" height="200px" frameborder="10px" scrolling="no"></iframe>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      // getPageUrl: htmlPage,
    };
  },
  created() {
    // 初始化时为window绑定一个方法
    window['vueDefinedMyProp'] = receiveParams => {
      this.receiveParamsFromHtml(receiveParams);
    };
  },
  methods: {
    receiveParamsFromHtml(res) {
      console.log(res);
    },
    invokeHtmlMethod() {
      console.log('log内容', window.frames['iframeMap']);
      window.frames['iframeMap'].lodaTable();
    }
  }
};
</script>
<style lang="scss" scoped></style>
